<template>
  <div class="body">
     <!-- <el-button @click="$router.go(0)" type="info" icon="el-icon-refresh-right"></el-button> -->
    <!-- <el-button type="danger" icon="el-icon-delete" @click="handDelete">删除</el-button> -->
    <!-- <el-button type="primary" icon="el-icon-upload2">导出</el-button> -->
         <el-row  class="mb8">
            <el-col :span="19">
                <el-button type="info" @click="shuaxin" icon="el-icon-refresh-right"></el-button>
               <!-- <el-button type="success" icon="el-icon-plus" @click="handleAdd">添加</el-button> -->
            </el-col>
            <el-col :span="5" class="seach">
                <el-input v-model="jigouName" placeholder="请输入文件名称"></el-input>
                <el-button type="primary" icon="el-icon-search" @click="seach"></el-button>
            </el-col>
        </el-row>
    <el-table
      ref="multipleTable"
      :data="paymentlist"
      tooltip-effect="dark"
      class="table xinde"
      @selection-change="handleSelectionChange"
    >
      <!-- <el-table-column type="selection" width="55"></el-table-column> -->
      <el-table-column align="center" prop="id" label="序号" width="50"></el-table-column>
      <el-table-column align="center" prop="apply_number" show-overflow-tooltip="true" label="发票类型" width="100">
         <template slot-scope="scope">{{
                scope.fplxdm == "004"
                  ? "专票"
                  : scope.fplxdm == "007"
                  ? "普票"
                  : "电子票"
              }}</template>
      </el-table-column>
      <el-table-column align="center" prop="djbh" show-overflow-tooltip="true" width="220" label="单据编号"></el-table-column>
      <!-- <el-table-column align="center" prop="zftype" label="开票人" width="80"></el-table-column> -->
      <el-table-column align="center" prop="spmc" label="商品名称" show-overflow-tooltip="true" width="220"></el-table-column>
      <el-table-column align="center" prop="amount" label="金额" width="120"></el-table-column>
      <el-table-column align="center" prop="ticket_company.gsmc" label="开票公司名称" show-overflow-tooltip="true" width="220"></el-table-column>
      <el-table-column align="center" prop="khmc" label="申请公司姓名" show-overflow-tooltip="true" width="220"></el-table-column>
       <el-table-column align="center" prop="image" show-overflow-tooltip="true" label="含税" width="100">
          <template slot-scope="scope">{{
                scope.hsbz ? "含税" : "不含税"
              }}</template>
       </el-table-column>
       <el-table-column align="center" prop="ssbm" label="税收编号" show-overflow-tooltip="true" width="220"></el-table-column>
       <el-table-column align="center" prop="tax" label="税率" show-overflow-tooltip="true" width="220"></el-table-column>
       <el-table-column align="center" prop="ticket_company.gssh" label="开票公司税号" show-overflow-tooltip="true" width="220"></el-table-column>
       <el-table-column align="center" prop="ticket_company.address" label="开票公司地址" show-overflow-tooltip="true" width="220"></el-table-column>
       <el-table-column align="center" prop="khsh" label="申请公司税号" show-overflow-tooltip="true" width="220"></el-table-column>
       <el-table-column align="center" prop="address" label="申请公司地址" show-overflow-tooltip="true" width="220"></el-table-column>
       <el-table-column align="center" prop="mobile" label="申请公司联系方式" show-overflow-tooltip="true" width="220"></el-table-column>
          <el-table-column
              align="center"
              prop="create_time_text"
              :show-overflow-tooltip="true"
              width="200"
              label="申请时间"
            >
            </el-table-column>
      <el-table-column align="center" label="支付状态" width="100">
        <template slot-scope="scope">
          <span
            style="margin-left: 10px"
          >{{ scope.row.state ==2 ? "支付成功":scope.row.state ==1 ?"支付中":"等待支付" }}</span>
        </template>
      </el-table-column>
      <el-table-column fixed="right" align="center" label="发票状态" width="80">
        <template slot-scope="scope">
          <span
            style="margin-left: 10px"
          >{{ scope.row.state ==2 ? "已领取":scope.row.billstatus ==1 ?"申请中":"未领取" }}</span>
        </template>
      </el-table-column>
    </el-table>
    <!-- 新增或修改 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="序号">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="项目编号">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="项目名称">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="担保机构名称">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">确定</el-button>
          <el-button @click="cancel">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <div class="block">
      <el-pagination
        background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :page-sizes="[10,20,30]"
        :page-size="params.limit"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
import { payment } from "@/api/payment";
export default {
  data() {
    return {
      paymentlist: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 表单参数
      form: {
        name: ""
      },
      // 表单校验
      rules: {},
      params: {
        limit: 10,
        offset: 0,
        keywords: ""
      },
      total: null,
      multipleSelection: []
    };
  },

  created() {
    this.payments();
  },
  methods: {
    //页面
    payments() {
      // this.params.user_id = sessionStorage.getItem('user_id')
      payment(this.params).then(response => {
        this.paymentlist = response.data.data.rows;
        this.total = response.data.data.total
      });
    },
    // 表单重置
    reset() {
      this.form = {
        name: ""
      };
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    //新增按钮操作
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加档案架";
    },
    //修改
    handleUpdate() {
      this.reset();
      this.open = true;
      this.title = "修改档案架";
    },
    //提交按钮
    onSubmit() {
      alert("submit!");
      this.open = false;
    },
    //删除
    handDelete() {
      alert("删除成功");
    },
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleSizeChange(val) {
      this.params.limit = val;
      console.log(this.params);
      this.payments();
    },
    handleCurrentChange(val) {
      this.params.offset = parseInt(val - 1) * this.params.limit;
      this.payments();
    },
  }
};
</script>

<style scoped>
.body {
  /* width: 86vw;
  height: 91vh; */
}

.table {
  width: 100%;
  margin-top: 2vh;
}

.block {
  position: fixed;
  bottom: 20px;
  right: 20px;
}
</style>
